#
# Makefile for LinuxChatty
#

CC = g++
INCLUDE_DIR = -I./ -I/usr/include/ncurses
LIB_DIR = -L/usr/lib/ncurses -Llib
CFLAGS = -c -Wall -g
LDFLAGS = -lncurses

C_SOURCES = services/html.c \
	services/b64.c

CPP_SOURCES = xml/tinystr.cpp \
	xml/tinyxml.cpp \
	xml/tinyxmlerror.cpp \
	xml/tinyxmlparser.cpp \
	json/jsoncpp.cpp \
	services/ResourceTable.cpp \
	services/ThreadService.cpp \
	services/HTTPClient.cpp \
	services/StringUtil.cpp \
	services/UIService.cpp \
	ui/Window.cpp \
	ui/ScrollableView.cpp \
	ui/ScrollableList.cpp \
	ui/ScrollableInput.cpp \
	ui/TextField.cpp \
	ui/RadioButton.cpp \
	ui/RadioGroup.cpp \
	ui/UIManager.cpp \
	ui/Screen.cpp \
	ui/AboutScreen.cpp \
	ui/MainMenuScreen.cpp \
	ui/ThreadScreen.cpp \
	ui/CommentsScreen.cpp \
	ui/DialogScreen.cpp \
	ui/PostScreen.cpp \
	ui/SettingsScreen.cpp \
	MainFrame.cpp \
	LinuxChatty.cpp

C_OBJECTS = $(C_SOURCES:.c=.o)
CPP_OBJECTS = $(CPP_SOURCES:.cpp=.o)

TARGET = linuxchatty

all: $(TARGET)

$(TARGET) : $(C_OBJECTS) $(CPP_OBJECTS)
	$(CC) $(C_OBJECTS) $(CPP_OBJECTS) -o $@ $(LIB_DIR) $(LDFLAGS)

.cpp.o :
	$(CC) $(INCLUDE_DIR) $(CFLAGS) $< -o $@

.c.o :
	$(CC) $(INCLUDE_DIR) $(CFLAGS) $< -o $@
	
clean:
	rm *.o xml/*.o json/*.o ui/*.o services/*.o $(TARGET)

depend:
	#makedepend ${INCS} ${SRCS}

tinyxml.o: tinyxml.h tinystr.h
tinyxmlparser.o: tinyxml.h tinystr.h
jsoncpp.o : json.h json-forwards.h
xmltest.o: tinyxml.h tinystr.h
tinyxmlerror.o: tinyxml.h tinystr.h
